import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login.vue'
import Register from '../views/Register.vue'
import Panel from '../views/Panel.vue';
import Home from '../components/Home.vue';


Vue.use(VueRouter)

const routes = [
  // 重定向login
  {
    path: '/',
    hidden: true,
    redirect: '/login'
  },
  {
    path: '/login',
    hidden: true,
    component: Login
  },
  {
    path: '/register',
    hidden: true,
    component: Register
  },
  // {
  //   path: '/panel',
  //   name: '首页',
  //   component: Panel,
  //   redirect: '/panel/home',
  //   children: [
  //     {
  //       path: '/panel/home',
  //       name: '首页',
  //       component: Home
  //     },
  //   ]
  // },
  {
    path: '/panel',
    name: '首页',
    component: Home, // 直接渲染 Home 组件
    children: [
      // 如果还有其他子路由，可以放在这里
    ]
  },
  {
    path: '/panel/system',
    name: '系统管理',
    component: Panel,
    children: [
      {
        path: './panel/usermanage',
        name: '用户管理',
        component: () => import('../components/systemmanage/usermanage')
      },
      {
        path: './panel/rolemanage',
        name: '角色管理',
        component: () => import('../components/systemmanage/rolemanage')
      },
      {
        path: './panel/rolemanage',
        name: '菜单管理',
        component: () => import('../components/systemmanage/menumanage')
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
